package com.paranoidmonkey.ode;

public class World extends ODEObject{
	protected World(long handle){
		this.handle=handle;
	}
	
	public World(){
		handle=AndrODE.dWorldCreate();
	}
	
	public void destroy(){
		AndrODE.dWorldDestroy (handle);
	}
	public void setGravity(float x, float y, float z){
		AndrODE.dWorldSetGravity (handle, x, y, z);
	}
	public void getGravity(Vector3 gravity){
		AndrODE.dWorldGetGravity (handle, gravity.data);
	}
	public void setERP(float erp){
		AndrODE.dWorldSetERP (handle, erp);
	}
	public float getERP(){
		return AndrODE.dWorldGetERP (handle);
	}
	public void setCFM(float cfm){
		AndrODE.dWorldSetCFM (handle, cfm);
	}
	public float getCFM(){
		return AndrODE.dWorldGetCFM (handle);
	}
	public void useSharedWorkingMemory(World from_world){
		AndrODE.dWorldUseSharedWorkingMemory(handle, from_world.handle);
	}
	public void cleanupWorkingMemory(){
		AndrODE.dWorldCleanupWorkingMemory(handle);
	}
//	public void (){AndrODE.dWorldSetStepMemoryReservationPolicy(handle,  dWorldStepReserveInfo []policyinfo/*=NULL*/);
//	public void (){AndrODE.dWorldSetStepMemoryManager(handle,  dWorldStepMemoryFunctionsInfo []memfuncs);
	public void step(float stepsize){
		AndrODE.dWorldStep (handle, stepsize);
	}
	public void quickStep(float stepsize){
		AndrODE.dWorldQuickStep (handle, stepsize);
	}
	public void impulseToForce(float stepsize, float ix, float iy, float iz, Vector3 force){
		AndrODE.dWorldImpulseToForce(handle, stepsize, ix, iy, iz, force.data);
	}
	public void setQuickStepNumIterations(int num){
		AndrODE.dWorldSetQuickStepNumIterations (handle, num);
	}
	public int getQuickStepNumIterations(){
		return AndrODE.dWorldGetQuickStepNumIterations (handle);
	}
	public void setQuickStepW(float over_relaxation){
		AndrODE.dWorldSetQuickStepW (handle, over_relaxation);
	}
	public float getQuickStepW(){
		return AndrODE.dWorldGetQuickStepW (handle);
	}
	public void setContactMaxCorrectingVel(float vel){
		AndrODE.dWorldSetContactMaxCorrectingVel (handle, vel);
	}
	public float getContactMaxCorrectingVel(){
		return AndrODE.dWorldGetContactMaxCorrectingVel (handle);
	}
	public void setContactSurfaceLayer(float depth){
		AndrODE.dWorldSetContactSurfaceLayer (handle, depth);
	}
	public float getContactSurfaceLayer(){
		return AndrODE.dWorldGetContactSurfaceLayer (handle);
	}
	public float getAutoDisableLinearThreshold(){
		return AndrODE.dWorldGetAutoDisableLinearThreshold (handle);
	}
	public void setAutoDisableLinearThreshold(float linear_threshold){
		AndrODE.dWorldSetAutoDisableLinearThreshold (handle, linear_threshold);
	}
	public float getAutoDisableAngularThreshold(){
		return AndrODE.dWorldGetAutoDisableAngularThreshold (handle);
	}
	public void setAutoDisableAngularThreshold(float angular_threshold){
		AndrODE.dWorldSetAutoDisableAngularThreshold (handle, angular_threshold);
	}
	public float getAutoDisableLinearAverageThreshold(){
		return AndrODE.dWorldGetAutoDisableLinearAverageThreshold (handle);
	}
	public void setAutoDisableLinearAverageThreshold(float linear_average_threshold){
		AndrODE.dWorldSetAutoDisableLinearAverageThreshold (handle, linear_average_threshold);
	}
	public float getAutoDisableAngularAverageThreshold(){
		return AndrODE.dWorldGetAutoDisableAngularAverageThreshold (handle);
	}
	public void setAutoDisableAngularAverageThreshold(float angular_average_threshold){
		AndrODE.dWorldSetAutoDisableAngularAverageThreshold (handle, angular_average_threshold);
	}
	public int getAutoDisableAverageSamplesCount(){
		return AndrODE.dWorldGetAutoDisableAverageSamplesCount (handle);
	}
	public void setAutoDisableAverageSamplesCount(int average_samples_count){
		AndrODE.dWorldSetAutoDisableAverageSamplesCount (handle, average_samples_count );
	}
	public int getAutoDisableSteps(){
		return AndrODE.dWorldGetAutoDisableSteps (handle);
	}
	public void setAutoDisableSteps(int steps){
		AndrODE.dWorldSetAutoDisableSteps (handle, steps);
	}
	public float getAutoDisableTime(){
		return AndrODE.dWorldGetAutoDisableTime (handle);
	}
	public void setAutoDisableTime(float time){
		AndrODE.dWorldSetAutoDisableTime (handle, time);
	}
	public int getAutoDisableFlag(){
		return AndrODE.dWorldGetAutoDisableFlag (handle);
	}
	public void setAutoDisableFlag(int do_auto_disable){
		AndrODE.dWorldSetAutoDisableFlag (handle, do_auto_disable);
	}
	public float getLinearDampingThreshold(){
		return AndrODE.dWorldGetLinearDampingThreshold (handle);
	}
	public void setLinearDampingThreshold(float threshold){
		AndrODE.dWorldSetLinearDampingThreshold(handle, threshold);
	}
	public float getAngularDampingThreshold(){
		return AndrODE.dWorldGetAngularDampingThreshold (handle);
	}
	public void setAngularDampingThreshold(float threshold){
		AndrODE.dWorldSetAngularDampingThreshold(handle, threshold);
	}
	public void setLinearDamping(float scale){
		AndrODE.dWorldSetLinearDamping (handle, scale);
	}
	public float getAngularDamping(){
		return AndrODE.dWorldGetAngularDamping (handle);
	}
	public void setAngularDamping(float scale){
		AndrODE.dWorldSetAngularDamping(handle, scale);
	}
	public void setDamping(float linear_scale,float angular_scale){
		AndrODE.dWorldSetDamping(handle,linear_scale,angular_scale);
	}
	public float getMaxAngularSpeed(){
		return AndrODE.dWorldGetMaxAngularSpeed (handle);
	}
	public void setMaxAngularSpeed(float max_speed){
		AndrODE.dWorldSetMaxAngularSpeed (handle, max_speed);
	}

	public boolean equals(Object b){
		if (b instanceof World) {
			if (((World)b).handle==handle){
				return true;
			}
		}
		return false;
	}
}
